package com.tancire.member.service.impl;

import java.util.List;
import javax.annotation.Resource;
import com.tancire.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.tancire.member.mapper.MemberPurseMapper;
import com.tancire.member.domain.MemberPurse;
import com.tancire.member.service.IMemberPurseService;

/**
 * 会员钱包Service业务层处理
 *
 * @author tancire
 * @date 2024-10-18
 */
@Service
public class MemberPurseServiceImpl implements IMemberPurseService {
    @Resource
    private MemberPurseMapper memberPurseMapper;

    /**
     * 查询会员钱包
     *
     * @param id 会员钱包主键
     * @return 会员钱包
     */
    @Override
    public MemberPurse selectMemberPurseById(Long id) {
        return memberPurseMapper.selectMemberPurseById(id);
    }

    /**
     * 查询会员钱包列表
     *
     * @param memberPurse 会员钱包
     * @return 会员钱包
     */
    @Override
    public List<MemberPurse> selectMemberPurseList(MemberPurse memberPurse) {
        return memberPurseMapper.selectMemberPurseList(memberPurse);
    }

    /**
     * 新增会员钱包
     *
     * @param memberPurse 会员钱包
     * @return 结果
     */
    @Override
    public int insertMemberPurse(MemberPurse memberPurse) {
        memberPurse.setCreateTime(DateUtils.getNowDate());
        return memberPurseMapper.insertMemberPurse(memberPurse);
    }

    /**
     * 修改会员钱包
     *
     * @param memberPurse 会员钱包
     * @return 结果
     */
    @Override
    public int updateMemberPurse(MemberPurse memberPurse) {
        memberPurse.setUpdateTime(DateUtils.getNowDate());
        return memberPurseMapper.updateMemberPurse(memberPurse);
    }

    /**
     * 批量删除会员钱包
     *
     * @param ids 需要删除的会员钱包主键
     * @return 结果
     */
    @Override
    public int deleteMemberPurseByIds(Long[] ids) {
        return memberPurseMapper.deleteMemberPurseByIds(ids);
    }

    /**
     * 删除会员钱包信息
     *
     * @param id 会员钱包主键
     * @return 结果
     */
    @Override
    public int deleteMemberPurseById(Long id) {
        return memberPurseMapper.deleteMemberPurseById(id);
    }

    /**
     * 根据会员ID 查询会员钱包
     *
     * @param memberId
     * @return
     */
    @Override
    public MemberPurse selectMemberPurseByMemberId(Long memberId) {
        return memberPurseMapper.selectMemberPurseByMemberId(memberId);
    }
}
